package com.tanhua.manage.jobs;

import com.tanhua.manage.service.AnalysisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

@Component
@Slf4j
public class AnalysisJob {
/*    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    @Scheduled(cron = "0/5 * * * * ?")
    public void doJob(){
   //     log.info(sdf.format(new Date()));
    }*/
    @Autowired
    private AnalysisService analysisService;
    @Scheduled(initialDelay = 3000,fixedRate = 600000)
    public void doJob(){
        log.info("后台任务开始执行");
        analysisService.analysisData();
        log.info("后台统计任务已经完成");
    }
}
